package org.lalib.controller.service;

import java.util.Date;
import java.util.List;

import org.lalib.acquire.IControllerService;
import org.lalib.entity.object.EFood;
import org.lalib.entity.object.EOrder;
import org.lalib.entity.object.ETable;
import org.lalib.mediator.MOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("cOrderService")
public class COrderService implements IControllerService {

	private static final long serialVersionUID = 1L;

	@Autowired
	MOrder mOrder;

	public EOrder getOrderById(Long id) {
		return mOrder.getEntityById(id);
	}

	public void save(EOrder order) {
		mOrder.insert(order);
	}

	public void update(EOrder order) {
		mOrder.update(order);
	}

	public void delete(EOrder order) {
		mOrder.remove(order);
	}

	public List<EOrder> getCurrentOrders(ETable table) {
		return mOrder.getCurrentOrders(table);
	}

	public List<EOrder> getCurrentOrdersForCooker(List<EFood> foods) {
		return mOrder.getCurrentOrders(foods);
	}
	
	public List<EOrder> getAllTakenOrders(Date startDate,Date endDate){
		return mOrder.getTakenOrders(startDate, endDate);
	}
}